package rolesystem.middle.utilityclasses;

import java.io.Serializable;


public class Square implements Serializable
{
	private int weight;
	private boolean reserved;
	private boolean blocked;
	private boolean known;
	private boolean knownPheromone;
	private Class otherData;
	
	public Square()
	{
		this.weight=0;
		this.reserved=false;
		this.blocked=false;
		this.known=false;
		this.knownPheromone=false;
		this.otherData=null;
	}
	
	public Square(int weight)
	{
		this.weight=weight;
		this.reserved=false;
		this.blocked=false;
		this.known=false;
		this.knownPheromone=false;
		this.otherData=null;
	}
	
	public Square(Square other_square)
	{
		this.weight=other_square.getWeight();
		this.reserved=other_square.getReserved();
		this.blocked=other_square.getBlocked();
		this.known=other_square.getKnown();
		this.knownPheromone=other_square.getKnownPheromone();
		this.otherData=other_square.getOtherData();
	}
	
	public synchronized int getWeight()
	{
		return weight;
	}
	
	public synchronized void setWeight(final int weight)
	{
		this.weight=weight;
	}
	
	public synchronized boolean getReserved()
	{
		return reserved;
	}
	
	public synchronized void setReserved(final boolean reserved)
	{
		this.reserved=reserved;
	}
	
	public synchronized boolean getReservedAndSetIfFalse()
	{
		if(reserved==false)
		{
			reserved=true;
			return false;
		}
		else
		{
			return true;
		}		
	}
	
	public synchronized boolean getBlocked()
	{
		return blocked;
	}
	
	public synchronized void setBlocked(final boolean blocked)
	{
		this.blocked=blocked;
	}
	
	public synchronized boolean getKnown()
	{
		return known;
	}
	
	public synchronized void setKnown(final boolean known)
	{
		this.known=known;
	}
	
	public synchronized boolean getKnownPheromone()
	{
		return knownPheromone;
	}
	
	public synchronized void setKnownPheromone(final boolean knownPheromone)
	{
		this.knownPheromone=knownPheromone;
	}
	
	public Class getOtherData()
	{
		return otherData;
	}
	
	public void setOtherData(final Class otherData)
	{
		this.otherData=otherData;
	}
}
